import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/Login'
import Index from '@/components/Index'
import Register from '@/components/Register'
import Order from '@/components/Order'
import Goods from '@/components/Goods'
import Set from '@/components/Set'
import Finance from '@/components/Finance'
import OrderDetail from '@/components/OrderDetail'
import MyGoods from '@/components/MyGoods'
import AddGoods from '@/components/AddGoods'
import AddtoMygoods from '@/components/AddtoMygoods'
import IdInformation from '@/components/IdInformation'
import LicenseInformation from '@/components/LicenseInformation'
import EditPassword from '@/components/EditPassword'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'login',
      meta: {
        title: '登录'
      },
      component: Login
    },
    {
      path: '/index',
      children: [
        {
          path: '',
          redirect:{name:'order'}
        },
        {
          path: 'order',
          name: 'order',
          meta: {
            title: '订单管理',
            index: 0
          },
          component: Order
        },
        {
          path: 'goods',
          component: Goods,
          meta: { title: '商品管理', index: 1},
          children: [
            {
              path:'',
              redirect:{name:'mygoods'}
            },
            {
              path: 'mygoods',
              name: 'mygoods',
              meta: { title: '商品管理',childIndex:0 },
              component: MyGoods
            },
            {
              path: 'addgoods',
              name: 'addgoods',
              meta: { title: '商品管理',childIndex:1 },
              component: AddGoods
            }
          ]
        },
        {
          path: 'finance',
          name: 'finance',
          meta: { title: '财务管理', index: 2 },
          component: Finance
        },
        {
          path: 'set',
          name: 'set',
          meta: { title: '设置', index: 3 },
          component: Set
        },
      ],
      component: Index
    },
    {
      path: '/register',
      name: 'register',
      meta: {
        title: '申请入驻'
      },
      component: Register
    },
    {
      path: '/orderDetail/:oid',
      name: 'orderDetail',
      meta: {
        title: '订单详情'
      },
      component: OrderDetail
    },
    {
      path: '/addtomygoods/:goods_id/:action',
      name: 'addtomygoods',
      meta: {
        title: '修改商品信息'
      },
      component: AddtoMygoods
    },
    {
      path:'/index/set/ID_information',
      name:'ID_information',
      meta:{title:'身份证信息'},
      component:IdInformation
    },
    {
      path:'/index/set/license_information',
      name:'license_information',
      meta:{title:'营业执照信息'},
      component:LicenseInformation
    },
    {
      path:'/index/set/EditPassword',
      name:'EditPassword',
      meta:{title:'修改密码'},
      component:EditPassword
    }
  ]
})
